<?php

$username = $_POST['username'];
$password = $_POST['password'];

include("opendb.php");
include("functions.php");
$res = isValidUser($username,$password);
if($res!=1) {
echo "$username = $password";
exit;
}

$lquery = "select * from Listing_Images where Area = '".$_POST['areaid']."'";
$lresult = mysql_query($lquery) or die ("SQL Error".mysql_error());
while($row = mysql_fetch_assoc($lresult))
{
unlink ("../listing_images/".$row['Path']);
unlink ("../listing_images/resize_".$row['Path']);
unlink ("../listing_images/t_".$row['Path']);
}

$sql = "delete from Listing_Images where Area = '".$_POST['areaid']."'";
$result = mysql_query($sql) or die ("SQL Error".mysql_error());

$sql = "delete from Listing_Areas where ID = '".$_POST['areaid']."'";
$result = mysql_query($sql) or die ("SQL Error".mysql_error());



echo "1";



?>